/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SIMRS.Apotek.sql;

import java.sql.Connection;
import java.sql.DriverManager;



/**
 *
 * @author yunniie
 */
public class KoneksiDatabase {
    public static Connection koneksi;
    
    public static Connection getKoneksi() {
        if(koneksi==null) {
         String url = "jdbc:mysql://localhost:3306/buahhati";
         String username="root";
         String password="";
            try {
                DriverManager.registerDriver(new com.mysql.jdbc.Driver());
                koneksi = DriverManager.getConnection(url, username, password);
                System.out.println("Koneksi ke database Berhasil");
            } catch (Exception e) {
                System.out.println("Koneksi ke database belum berhasil");
            }
         
        }
            
        return koneksi;
        
    }
            
            
}
